/**
 * Base object creator for widgets.
 */

function Widget(options) {
	var that = {};
	
	that.getContainer = function() {
		return $("#"+options.id);
	};

	that.show = function() {
		this.getContainer().show();
	};

	that.hide = function() {
		this.getContainer().hide();
	};
	
	that.toggle = function(display) {
		this.getContainer().toggle(display);
	};

	that.hideMwl = function() {
		return sprintf("mwl.hide('#%s');",options.id);
	};
	
	that.showMwl = function() {
		return sprintf("mwl.show('#%s');",options.id);
	};
	
	return that;
}

Widget.uid = (function() {
	var id = 0;
	return function() {
		return "widget-" + id++;
	};
})();
